[feat][broker] PIP-441:Add broker-level metrics for non-recoverable data skips#24726
Open
codelipenghui wants to merge 2 commits into
Open
[feat][broker] PIP-441:Add broker-level metrics for non-recoverable data skips#24726codelipenghui wants to merge 2 commits into
codelipenghui wants to merge 2 commits into
Conversation
This change implements GitHub PR apache#24716 to add operational visibility for non-recoverable data loss events in Apache Pulsar brokers. Key Changes: - Add NonRecoverableDataMetricsCallback interface in managed-ledger module - Integrate callback in ManagedLedgerImpl.skipNonRecoverableLedger() - Integrate callback in ManagedCursorImpl.skipNonRecoverableEntries() - Configure callback in BrokerService during managed ledger creation - Add two new metrics in BrokerOperabilityMetrics: - pulsar.broker.non.recoverable.ledgers.skipped.count - pulsar.broker.non.recoverable.entries.skipped.count - Support both Prometheus and OpenTelemetry metrics - Comprehensive test coverage including end-to-end integration tests The metrics are always available regardless of ManagedLedgerInterceptor configuration, providing reliable operational monitoring for data loss scenarios. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
|
/pulsarbot run-failure-checks |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #24726 +/- ##
============================================
+ Coverage 74.17% 74.25% +0.08%
- Complexity 33470 33628 +158
============================================
Files 1895 1902 +7
Lines 148029 148512 +483
Branches 17142 17216 +74
============================================
+ Hits 109796 110282 +486
+ Misses 29479 29430 -49
- Partials 8754 8800 +46
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Shawyeok
reviewed
Sep 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implementation for #24716
This PR implements broker-level metrics for tracking non-recoverable data skips in Apache Pulsar, providing operational visibility for data loss events.
Key Features Added
ManagedLedgerImpl.skipNonRecoverableLedger()to trigger callback when ledgers are skippedManagedCursorImpl.skipNonRecoverableEntries()to count and report skipped entriesNew Metrics
pulsar.broker.non.recoverable.ledgers.skipped.count- Tracks the number of entire ledgers skipped due to non-recoverable issuespulsar.broker.non.recoverable.entries.skipped.count- Tracks the number of individual entries skipped due to non-recoverable issuesDesign Decisions
BrokerServiceduring topic creationTesting Coverage
NonRecoverableDataCallbackTestOpenTelemetryBrokerOperabilityStatsTestImplementation Details
The implementation uses a callback pattern where:
BrokerServicesets up theNonRecoverableDataMetricsCallbackduring managed ledger configurationManagedLedgerImplcalls the callback whenskipNonRecoverableLedger()is invokedManagedCursorImplcalls the callback whenskipNonRecoverableEntries()is invoked with actual entry countsBrokerOperabilityMetricswhich maintains both Prometheus and OpenTelemetry countersTest plan
Documentation
docdoc-requireddoc-not-neededdoc-complete